<?php

namespace app\adminmall\controller;
use app\adminmall\model\CashModel;
use app\admin\model\Member as MemberModel;
use app\common\controller\AdminBaseController;
use think\Db;
/**
 * 提现方式列表
 */
class CashController extends AdminBaseController
{
 	 protected $model;
 	 protected $member_model;
	
    protected function _initialize() {
        parent::_initialize();
        $this->model = new CashModel();
        $this->member_model = new MemberModel();
    }
    /**
     * 提现方式列表
     * @author [lx] 
     */
    public function index( $page = 1){
    	$list=$this->model
    	->table('long_member m,long_mall_cash c')
    	->where('c.uid=m.id')
    	->paginate(10); 
        return $this->fetch('index', ['list' => $list]);
    }
    /**
     * 查询
     * @author [lx] 
     */
    public function search(){
    	$map = [];
    	$field = 'm.*,g.id,g.mobile,g.nick_name,g.city';
		if(request()->isPost()){
		 	$param = input('post.');
			//用户名称
			if($param['name']){
				$map['nick_name'] = ['like', '%'.$param['name'].'%'];
			}
			//手机号码
			if($param['mobile']){
				$map['mobile'] = ['like', '%'.$param['mobile'].'%'];
			}
			//用户类型
			if($param['type'] != 0){
				$map['user_type'] = $param['type'];
			}
			 //创建时间
			if($param['add_time']&&$param['end_time']){
				$map['m.add_time'] = ['between time', [$param['add_time'],$param['end_time']]];
			}
	    }  
    		$list=Db::name("mall_cash")
    		->alias('m')
    		->join('__MEMBER__ g','g.id=m.uid')
    		->field($field)
    		->where($map)
    		->order("m.add_time desc")
    		->paginate(10);       
        return $this->fetch('index', ['list' => $list]);
    }


   
}